<div class="form-group">
	<label class="col-lg control-label">排序</label>
	<div class="col-sm-9 col-xs-12">
		{ife 'sale.coupon' $item}
		<input type="text" name="displayorder" class="form-control" value="{$item['displayorder']}"  />
		<span class='help-block'>数字越大越靠前</span>
		{else}
		<div class='form-control-static'>{$item['displayorder']}</div>
		{/if}
	</div>
</div>

<div class="form-group">
	<label class="col-lg control-label must"> 优惠券名称</label>
	<div class="col-sm-9 col-xs-12">
		{ife 'sale.coupon' $item}
		<input type="text" name="couponname" class="form-control" value="{$item['couponname']}" data-rule-required="true"  />
		{else}
		<div class='form-control-static'>{$item['couponname']}</div>
		{/if}
	</div>
</div>


<div class="form-group">
	<label class="col-lg control-label">分类</label>
	<div class="col-sm-9 col-xs-12">
		{ife 'sale.coupon' $item}
		<select name='catid' class='form-control select2'>
			<option value=''></option>
			{loop $category $k $c}
			<option value='{$k}' {if $item['catid']==$k}selected{/if}>{$c['name']}</option>
			{/loop}
		</select>
		{else}
		<div class='form-control-static'>{if empty($item['catid'])}暂时无分类{else} {$category[$item['catid']]['name']}{/if}</div>
		{/if}
	</div>
</div>
<div class="form-group">
	<label class="col-lg control-label">缩略图</label>
	<div class="col-sm-9 col-xs-12">
		{ife 'sale.coupon' $item}
		{php echo tpl_form_field_image2('thumb', $item['thumb'])}
		{else}
		<input type="hidden" name="thumb" value="{$item['thumb']}"/>
		{if !empty($item['thumb'])}
		<a href='{php echo tomedia($item['thumb'])}' target='_blank'>
		   <img src="{php echo tomedia($item['thumb'])}" style='width:100px;border:1px solid #ccc;padding:1px' />
		</a>
		{/if}
		{/if}
	</div>
</div>
<div class="form-group">
	<label class="col-lg control-label">使用条件</label>
	<div class="col-sm-9 col-xs-12">
		{ife 'sale.coupon' $item}
		<input type="text" name="enough" class="form-control" value="{$item['enough']}"  />
		<span class='help-block' >{if empty($type)|| $type==2}消费{else}充值{/if}满多少可用, 空或0 不限制</span>
		{else}
		<div class='form-control-static'>{if $item['enough']>0}满 {$item['enough']} 可用 {else}不限制{/if}</div>
		{/if}
	</div>
</div>


{ife 'sale.coupon' $item}

<div class="form-group">
	<label class="col-lg control-label">使用时间限制</label>

	
	<div class="col-sm-7">
		<div class='input-group'>
			<span class='input-group-addon'>
				<label class="radio-inline" style='margin-top:-5px;' ><input type="radio" name="timelimit" value="0" {if $item['timelimit']==0}checked{/if}>获得后</label>
			</span>

			<input type='text' class='form-control' name='timedays' value="{$item['timedays']}" />
			<span class='input-group-addon'>天内有效(空为不限时间使用)</span>
		</div>
	</div>
 
</div>

<div class="form-group">
	<label class="col-lg control-label"></label>
	<div class="col-sm-3">
		<div class='input-group'>
			<span class='input-group-addon'>
				<label class="radio-inline" style='margin-top:-5px;' ><input type="radio" name="timelimit" value="1" {if $item['timelimit']==1}checked{/if}>在日期</label>
			</span>
			{php echo tpl_form_field_daterange('time', array('starttime'=>date('Y-m-d', $starttime),'endtime'=>date('Y-m-d', $endtime)));}
			<span class='input-group-addon'>内有效</span>
		</div>
	</div>
	 

</div>
{else}
<div class="form-group">
	<label class="col-lg control-label">使用时间限制</label>
 
	<div class="col-sm-9 col-xs-12">
		<div class='form-control-static'>
			{if $item['timelimit']==0}
			{if !empty($item['timedays'])}获得后 {$item['timedays']} 天内有效{else}不限时间{/if}
			{else}
			{php echo date('Y-m-d',$starttime)} - {php echo date('Y-m-d',$endtime)}  范围内有效
			{/if}</div>
	</div>
</div>
{/if}

{if empty($type)}
	{template 'sale/coupon/post/consume'}
{elseif $type==1}
	{template 'sale/coupon/post/recharge'}
{elseif $type==2}
	{template 'sale/coupon/post/cashier'}
{/if}


  


         <div class="form-group">
                <label class="col-lg control-label">发放总数</label>
                <div class="col-sm-9 col-xs-12">
                    {ife 'sale.coupon' $item}
                    <input type="text" name="total" class="form-control" value="{$item['total']}"  />
                    <span class='help-block' >优惠券总数量，没有不能领取或发放,-1 为不限制张数</span>
                    {else}
                    <div class='form-control-static'>{if $item['total']==-1}无限数量{else}剩余 {$item['total']} 张{/if}</div>
                    {/if}
                </div>
   </div>